/**
 * @flow
 */
import React, { Component } from 'react';
import TabBarItem from './TabBarItem';
import Home from '../home/Home';
import Mine from '../mine/Mine';
import Shop from '../shop/Shop';
import More from '../more/More';
import {TabNavigator,TabBarBottom} from 'react-navigation';

const TabBar = TabNavigator({
    Home:{
        screen:Home,
        navigationOptions:({navigation}) => ({
            tabBarLabel:'首页',
            tabBarIcon:({focused,tintColor}) => (
                <TabBarItem
                    tintColor={tintColor}
                    focused={focused}
                    normalImage={require('../image/icon_tabbar_homepage.png')}
                    selectedImage={require('../image/icon_tabbar_homepage_selected.png')}
                />
            )
        })
    },
    Shop:{
        screen:Shop,
        navigationOptions:({navigation}) => ({
            tabBarLabel:'商家',
            tabBarIcon:({focused,tintColor}) => (
                <TabBarItem
                    tintColor={tintColor}
                    focused={focused}
                    normalImage={require('../image/icon_tabbar_merchant_normal.png')}
                    selectedImage={require('../image/icon_tabbar_merchant_selected.png')}
                />
            )
        })
    },
    Mine:{
        screen:Mine,
        navigationOptions:({navigation}) => ({
            tabBarLabel:'我的',
            tabBarIcon:({focused,tintColor}) => (
                <TabBarItem
                    tintColor={tintColor}
                    focused={focused}
                    normalImage={require('../image/icon_tabbar_mine.png')}
                    selectedImage={require('../image/icon_tabbar_mine_selected.png')}
                />
            )
        })
    },
    More:{
        screen:More,
        navigationOptions:({navigation}) => ({
            tabBarLabel:'更多',
            tabBarIcon:({focused,tintColor}) => (
                <TabBarItem
                    tintColor={tintColor}
                    focused={focused}
                    normalImage={require('../image/icon_tabbar_misc.png')}
                    selectedImage={require('../image/icon_tabbar_misc_selected.png')}
                />
            )
        })
    }
},{
    tabBarComponent:TabBarBottom,
    tabBarPosition:'bottom',
    swipeEnabled:true,
    animationEnabled:false,
    lazy:false,
    tabBarOptions:{
        activeTintColor:'#FF6000',
        inactiveTintColor:'#979797',
        style:{backgroundColor:'#fff',borderTopWidth:1,borderTopColor:'#e8e8e8'},
        labelStyle:{fontSize:12}
    }
});

export default TabBar;